package com.zhixiang.xaec.action.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zhixiang.core.web.action.BaseAction;
import com.zhixiang.xaec.entity.demo.Demo;
import com.zhixiang.xaec.entity.demo.Many2OneDemo;
import com.zhixiang.xaec.service.demo.Many2OneService;

@Controller("many2OneAction")
@Scope("prototype")
public class Many2OneAction extends BaseAction
{

    /**
     * 意义，目的和功能，以及被用到的地方<br>
     */
    private static final long serialVersionUID = -3467571811811661688L;
    private Many2OneDemo mo;
    public Many2OneDemo getMo()
    {
        return mo;
    }

    public void setMo(Many2OneDemo mo)
    {
        this.mo = mo;
    }

    @Autowired
    public Many2OneService many2OneServie;
    
    public String save(){
        
        mo = new Many2OneDemo();
        mo.setmName("lisi");
        Demo demo = new Demo();
        demo.setName("zhangsan");
        mo.setDemo(demo);
        many2OneServie.save(mo);
        return SUCCESS;
    }
}
